<?xml version="1.0" encoding="UTF-8"?>
<!--
 Shamim Ahmmed
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich">

    <ui:composition template="/templates/basic.xhtml">

        <ui:param name="moduleTitle" value="#{msg.User_WeeklyView_Title}"></ui:param>

        <ui:define name="leftBar">
            <ui:include src="/templates/include/todayevent.xhtml" />
        </ui:define>

        <ui:define name="body">
            <a4j:outputPanel layout="block" style="margin-left: 10px;">
                <h:form id="form" >

                    <h:panelGrid  columnClasses="col_class_left,col_class,col_class_right" columns="3" cellpadding="1" cellspacing="1" width="100%" border="0">
                        <h:commandButton action="#{weeklyViewHandler.goPreviousWeek}" value="#{msg.User_WeeklyView_PrevWeek}" />

                        <h:outputText  value="#{weeklyViewHandler.currentDate}" >
                            <f:convertDateTime dateStyle="default" pattern="dd-MM-yyyy"/>
                        </h:outputText>
                        <h:commandButton  action="#{weeklyViewHandler.goNextWeek}" value="#{msg.User_WeeklyView_NextWeek}" />
                    </h:panelGrid>
                    <rich:dataTable id="idDataGrid"  width="100%" rows="10"  rowClasses=",container_even_row_style"  columnsWidth="150,,150"
                                    var="item" value="#{weeklyViewHandler.weeklyEvents}" headerClass="table_column_style"
                                    cellpadding="0" cellspacing="0" >
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.User_WeeklyView_TblHeader_Date}"/>
                            </f:facet>
                            <h:outputText value="#{item.dtEventdate}">
                                <f:convertDateTime timeZone="GMT+2" dateStyle="default" pattern="dd-MM-yyyy h:mm a"/>
                            </h:outputText>

                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.User_WeeklyView_TblHeader_Disc}"/>
                            </f:facet>
                            <h:outputText value="#{item.strEventdescription}"></h:outputText>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.User_WeeklyView_TblHeader_Freq}"/>
                            </f:facet>
                            <h:outputText value="#{item.intFrequencyID.strFrequencydescription}"></h:outputText>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.User_WeeklyView_TblHeader_Category}"/>
                            </f:facet>
                            <h:outputText value="#{item.intEventTypeID.strEventtype}"></h:outputText>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.User_WeeklyView_TblHeader_Action}"/>
                            </f:facet>
                            <rich:spacer width="15"/>

                            <a4j:commandLink reRender="idEventDialog"  actionListener="#{weeklyViewHandler.loadEvent}"   oncomplete="Richfaces.showModalPanel('idEventDialog')">
                                <f:attribute name="eventid" value="#{item.intEventID}" />
                                <h:graphicImage value="/images/edit.png" >
                                </h:graphicImage>
                                <rich:toolTip styleClass="tooltips_style"  >
                                    <span class="tooltips_span_style">
                                        <h:outputText value="#{msg.User_WeeklyView_EditTooltip}"/><br/>
                                    </span>
                                </rich:toolTip>
                                <!--</a4j:commandLink>-->
                            </a4j:commandLink>
                            <rich:spacer width="15"/>


                            <h:commandLink  actionListener="#{displayeventhandler.deleteEvent}"
                                onclick="if(!confirm('Are you sure you want to delete this record?'))return false;">
                                <f:attribute name="intEventID" value="#{item.intEventID}" />
                                <h:graphicImage value="/images/delete.png" >
                                </h:graphicImage>
                                <rich:toolTip styleClass="tooltips_style"  >
                                    <span class="tooltips_span_style">
                                        <h:outputText value="#{msg.User_WeeklyView_DeleteTooltip}"/><br/>
                                    </span>
                                </rich:toolTip>
                            </h:commandLink>
                            <!--</a4j:commandLink>-->
                        </rich:column>
                    </rich:dataTable>
                    <rich:datascroller id="idDataScroller" align="center"  for="idDataGrid" maxPages="5" />


                </h:form>



            </a4j:outputPanel>
        </ui:define>

        <ui:define name="modalPanels">
            <a4j:region>
                <ui:include src="./modal/eventDialog.xhtml">

                </ui:include>
            </a4j:region>
        </ui:define>

    </ui:composition>
</html>
